//斗地主发牌

import java.util.ArrayList;
import java.util.Collections;

public class syb {
    public static void main(String[] args) {

        // 花色
        String[] color = { "♠","♥","♣","♦" };
        // 数字
        String[] num = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
        // 牌盒
        ArrayList<String> box = new ArrayList<>();

        for (int i = 0; i < color.length; i++) {
            for (int j = 0; j < num.length; j++) {
                box.add(color[i] + num[j]);
            }
        }

        box.add("小王");
        box.add("大王");

        // 洗牌
        Collections.shuffle(box);
        //System.out.println(box);

        // 三名玩家
        ArrayList<Object> 玩家1 = new ArrayList<>();
        ArrayList<Object> 玩家2 = new ArrayList<>();
        ArrayList<Object> 玩家3= new ArrayList<>();

        // 发牌
        for (int i = 0; i < box.size() - 3; i++) {
            if (i % 3 == 0) {
                玩家1.add(box.get(i));
            }
            else if (i % 3 == 1) {
                玩家2.add(box.get(i));
            }
            else if (i % 3 == 2) {
                玩家3.add(box.get(i));
            }
        }

        System.out.println("玩家1:"+玩家1);

        System.out.println("玩家2:"+玩家2);

        System.out.println("玩家3:"+玩家3);

        method01(box);  //底牌
    }

    public static void method01(ArrayList<String> box) {
        System.out.println("底牌：");
        for (int i =box.size()-3 ; i <box.size() ; i++) {
            System.out.print(box.get(i)+" ");
        }
    }

}
